@extends('admin.base')

@section('content')
    <div class="layui-card" style="margin-top: 20px;">
        <div class="layui-card-body">

            <div class="layui-form">
                {{csrf_field()}}
                {{method_field('put')}}
                <input type="hidden" name="id" value="{{$data['id']}}" >

                <div class="layui-form-item">
                    <label class="layui-form-label">网站位置</label>
                    <div class="layui-input-inline">
                        <select name="website_id" lay-filter="website_id">
                            @foreach($websiteData as $val)
                                <option @if($val['id'] == $data['website_id']) selected @endif value="{{$val['id']}}">{{$val['names']}}</option>
                            @endforeach
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">栏目</label>
                    <div class="layui-input-inline">
                        <select name="websites_topic_id" id="websites_topic_id" lay-verify="required">
                            <option value="{{$data['websites_topic_id']}}" selected>{{$data['topicName']}}</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">文章标题</label>
                    <div class="layui-input-block" style="width: 500px !important;">
                        <input type="text" name="title" id="title" placeholder="请输入" autocomplete="off" value="{{$data['title']}}" required class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block" style="width: 200px !important;">
                        <select name="status">
                            <option @if($data['status'] == 0) selected @endif value="0">审核中</option>
                            <option @if($data['status'] == 1) selected @endif value="1">已拒绝</option>
                            <option @if($data['status'] == 2) selected @endif value="2">已发布</option>
                            <option @if($data['status'] == -1) selected @endif value="-1">已下架</option>
                        </select>
                    </div>
                </div>

                <input type="hidden" value="15" id="tong">
                <div class="layui-form-item"  style="width:80%">
                    <label class="layui-form-label required" style="width: 10%">封面图</label>
                    <div class="layui-input-block">
                        <div class="layui-upload">
                            <button type="button" class="layui-btn layui-btn-sm" id="uploadPic">上传</button>
                            <div class="layui-upload-list">
                                <ul id="layui-upload-box" class="layui-clear">
                                    <img style="width: 150px;" src="{{$data['thumbs']}}">
                                </ul>
                                <input type="hidden" name="cover_url" id="thumb" lay-verify="required" value="{{$data['thumbs']}}"/>
                            </div>
                        </div>
                    </div>
                </div>



                <div class="layui-form-item">
                    <label class="layui-form-label">文章内容</label>
                    <div class="layui-input-block">
                        <script id="editor" name="content" style="width:800px;height:700px;">{!!$data['content']!!}</script>
                    </div>
                </div>



                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button type="submit" class="layui-btn layui-btn-sm" lay-submit="" lay-filter="formSubmit"><i class="fa fa-save"></i> 保存</button>
                        <a href="javascript:parent.layui.layer.closeAll();" class="layui-btn layui-btn-primary layui-btn-sm"><i class="fa fa-reply-all" aria-hidden="true"></i>  取消</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('script')
    @include("admin.articles._js_edit")
    @include('admin.common._js_upload')
@endsection
